<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../template/WorkspaceTemplate.xhtml"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:f="http://java.sun.com/jsf/core">

    <ui:define name="top">
        
    </ui:define>

    <ui:define name="left">
    </ui:define>

    <ui:define name="right">
       
    </ui:define>

    <ui:define name="content">
        <h:form prependId="false">
            <p:messages id="msgs" showDetail="true"/>
            <p:dataTable id="roleTable" var="role" value="#{userRoleManagerBean.allRoles}" >
                <f:facet name="header">
                    Delete Security Role
                </f:facet>

                <p:column headerText="Role Name" style="width:150px"
                          filterBy="#{role.roleName}">
                    <h:outputText value="#{role.roleName}"/>
                </p:column>

                <p:column headerText="Department" style="width: 150px"
                          filterBy="#{role.department}">
                    <h:outputText value="#{role.department}"/>
                </p:column>

                <p:column headerText="Option" style="width: 150px">
                    <p:commandButton id="deleteRole" value="Delete" oncomplete="dlg3.show()"
                                     action="#{userRoleManagerBean.selectRole(role.id)}"/>
                </p:column>
            </p:dataTable>
            <p:confirmDialog widgetVar="dlg3" message="Are you sure to delete the selected security role?"
                             showEffect="bounce" hideEffect="explode"
                             header="Confirm to Delete" severity="alert">
                <p:commandButton value="Delete" onstart="dlg3.hide()" ajax="false" update="msgs"
                                 action="#{userRoleManagerBean.deleteSelectedRole}"/>
                <p:commandButton value="Cancel" onclick="dlg3.hide()" type="button" />
            </p:confirmDialog>
            <p:ajaxStatus>
                <f:facet name="start">
                    <h:graphicImage value="./../images/ajaxloading.gif"/>
                </f:facet>
                <f:facet name="complete">
                    <h:outputText value=""/>
                </f:facet>
            </p:ajaxStatus>
        </h:form>
    </ui:define>

    <ui:define name="bottom">
       
    </ui:define>

</ui:composition>
